#include "../include/page_lib_preprocessor.hpp"
#include "../include/web_page_query.hpp"

#include <iostream>

using namespace gcj;

using std::cout;
using std::endl;

//饿汉模式，直接生成
SplitTool *SplitTool::_pInstance = SplitTool::getInstance();
SplitTool::AutoRelease SplitTool::_at;

WebLib * WebLib::_pInstance = WebLib::getInstance();
WebLib::AutoRelease WebLib::_at;

void test_PageLibPreprocessor() {
    //生成倒排索引，并写入到 invertindex.dat 文件中
    PageLibPreprocessor plp;
    plp.storeOnDisk();
    cout << "write Successful!" << endl;
}

void test_WebPageQuery() {
    WebPageQuery wbq;
    string res = wbq.doQuery("年货");
    cout << res << endl;  //res：发回给用户的查询结果
}

int main()
{
    /* test_split(); */
    /* test_web(); */
    /* test_PageLibPreprocessor(); */
    WebLib * webLib = WebLib::getInstance();
    webLib->loadLibrary();
    test_WebPageQuery();

    return 0;
}
